﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiLinetypeDash : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiLinetypeDash(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiLinetypeDash obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiLinetypeDash()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiLinetypeDash(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public double[] ShapeOffset
		{
			get
			{
				IntPtr ptr = GlobalsPINVOKE.OdGiLinetypeDash_shapeOffset_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				double[] array = new double[2];
				byte[] array2 = new byte[8];
				for (int i = 0; i < 8; i++)
				{
					array2[i] = Marshal.ReadByte(ptr, i);
				}
				array[0] = BitConverter.ToDouble(array2, 0);
				for (int j = 0; j < 8; j++)
				{
					array2[j] = Marshal.ReadByte(ptr, j + 8);
				}
				array[1] = BitConverter.ToDouble(array2, 0);
				return array;
			}
			set
			{
				if (value.Length != 2)
				{
					throw new Exception("ShapeOffset is a pair of double values");
				}
				IntPtr intPtr = Marshal.AllocCoTaskMem(16);
				int num = 0;
				foreach (byte val in BitConverter.GetBytes(value[0]))
				{
					Marshal.WriteByte(intPtr, num++, val);
				}
				foreach (byte val2 in BitConverter.GetBytes(value[1]))
				{
					Marshal.WriteByte(intPtr, num++, val2);
				}
				GlobalsPINVOKE.OdGiLinetypeDash_shapeOffset_set(this.swigCPtr, new HandleRef(null, intPtr));
				Marshal.FreeCoTaskMem(intPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double length
		{
			get
			{
				double result = GlobalsPINVOKE.OdGiLinetypeDash_length_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_length_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double shapeScale
		{
			get
			{
				double result = GlobalsPINVOKE.OdGiLinetypeDash_shapeScale_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_shapeScale_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public double shapeRotation
		{
			get
			{
				double result = GlobalsPINVOKE.OdGiLinetypeDash_shapeRotation_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_shapeRotation_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public ushort flags
		{
			get
			{
				ushort result = GlobalsPINVOKE.OdGiLinetypeDash_flags_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_flags_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public ushort shapeNumber
		{
			get
			{
				ushort result = GlobalsPINVOKE.OdGiLinetypeDash_shapeNumber_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_shapeNumber_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		private OdGiLinetypeDash.offset shapeOffset
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiLinetypeDash_shapeOffset_get(this.swigCPtr);
				OdGiLinetypeDash.offset result = (intPtr == IntPtr.Zero) ? null : new OdGiLinetypeDash.offset(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_shapeOffset_set(this.swigCPtr, OdGiLinetypeDash.offset.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public string textString
		{
			get
			{
				string result = GlobalsPINVOKE.OdGiLinetypeDash_textString_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_textString_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdDbStub styleId
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiLinetypeDash_styleId_get(this.swigCPtr);
				OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiLinetypeDash_styleId_set(this.swigCPtr, OdDbStub.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGiLinetypeDash() : this(GlobalsPINVOKE.new_OdGiLinetypeDash(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isRotationAbsolute()
		{
			bool result = GlobalsPINVOKE.OdGiLinetypeDash_isRotationAbsolute(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setRotationAbsolute(bool value)
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setRotationAbsolute__SWIG_0(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setRotationAbsolute()
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setRotationAbsolute__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isRotationUpright()
		{
			bool result = GlobalsPINVOKE.OdGiLinetypeDash_isRotationUpright(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setRotationUpright(bool value)
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setRotationUpright__SWIG_0(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setRotationUpright()
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setRotationUpright__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isEmbeddedTextString()
		{
			bool result = GlobalsPINVOKE.OdGiLinetypeDash_isEmbeddedTextString(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEmbeddedTextString(bool value)
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setEmbeddedTextString__SWIG_0(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setEmbeddedTextString()
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setEmbeddedTextString__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isEmbeddedShape()
		{
			bool result = GlobalsPINVOKE.OdGiLinetypeDash_isEmbeddedShape(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEmbeddedShape(bool value)
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setEmbeddedShape__SWIG_0(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setEmbeddedShape()
		{
			GlobalsPINVOKE.OdGiLinetypeDash_setEmbeddedShape__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public class offset : IDisposable
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public offset(IntPtr cPtr, bool cMemoryOwn)
			{
				this.swigCMemOwn = cMemoryOwn;
				this.swigCPtr = new HandleRef(this, cPtr);
			}

			[EditorBrowsable(EditorBrowsableState.Never)]
			public static HandleRef getCPtr(OdGiLinetypeDash.offset obj)
			{
				if (obj != null)
				{
					return obj.swigCPtr;
				}
				return new HandleRef(null, IntPtr.Zero);
			}

			~offset()
			{
				this.Dispose();
			}

			public virtual void Dispose()
			{
				if (this.swigCPtr.Handle != IntPtr.Zero)
				{
					if (this.swigCMemOwn)
					{
						lock (this.locker)
						{
							if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
							{
								this.swigCMemOwn = false;
								GlobalsPINVOKE.delete_OdGiLinetypeDash_offset(this.swigCPtr);
							}
						}
						this.swigCMemOwn = false;
					}
					this.swigCPtr = new HandleRef(null, IntPtr.Zero);
				}
				GC.SuppressFinalize(this);
			}

			public double x
			{
				get
				{
					double result = GlobalsPINVOKE.OdGiLinetypeDash_offset_x_get(this.swigCPtr);
					if (GlobalsPINVOKE.SWIGPendingException.Pending)
					{
						throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
					}
					return result;
				}
				set
				{
					GlobalsPINVOKE.OdGiLinetypeDash_offset_x_set(this.swigCPtr, value);
					if (GlobalsPINVOKE.SWIGPendingException.Pending)
					{
						throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
					}
				}
			}

			public double y
			{
				get
				{
					double result = GlobalsPINVOKE.OdGiLinetypeDash_offset_y_get(this.swigCPtr);
					if (GlobalsPINVOKE.SWIGPendingException.Pending)
					{
						throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
					}
					return result;
				}
				set
				{
					GlobalsPINVOKE.OdGiLinetypeDash_offset_y_set(this.swigCPtr, value);
					if (GlobalsPINVOKE.SWIGPendingException.Pending)
					{
						throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
					}
				}
			}

			public offset() : this(GlobalsPINVOKE.new_OdGiLinetypeDash_offset(), true)
			{
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}

			private object locker = new object();

			private HandleRef swigCPtr;

			protected bool swigCMemOwn;
		}
	}
}
